﻿using BarrageGameAssistant.Core.Enums;
using System.Drawing;

namespace BarrageGameAssistant.Core.Model
{
    /// <summary>
    /// 游戏过程数据匹配检测数据
    /// </summary>
    public class ProcessMatchData
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();

        /// <summary>
        /// 标定名称
        /// </summary>
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 识别前处理方式
        /// </summary>
        public PreProcessingModeType PreProcessingMode { get; set; } = PreProcessingModeType.None;

        /// <summary>
        /// 匹配方式 0 Orc识别 1 位置追踪
        /// </summary>
        public ProcessMatchType MatchType { get; set; } = ProcessMatchType.Tracker;

        /// <summary>
        /// 匹配阈值
        /// </summary>
        public double Threshold { get; set; } = 0.65f;

        /// <summary>
        /// 场景大小
        /// </summary>
        public Size SceneSize { get; set; }

        /// <summary>
        /// 变量名
        /// </summary>
        public string VariableName { get; set; } = string.Empty;

        /// <summary>
        /// 进度条滑杆标定图片Id
        /// </summary>
        public string? ProgressBarKeyImage { get; set; } = string.Empty;

        /// <summary>
        /// 进度条滑杆标定图片Id 1
        /// </summary>
        public string? ProgressBarKeyImage1 { get; set; } = string.Empty;

        /// <summary>
        /// 进度条左值或上值
        /// </summary>
        public float ProgressBarLeftValue { get; set; } = -100f;

        /// <summary>
        /// 进度条右值或下值
        /// </summary>
        public float ProgressBarRightValue { get; set; } = 100f;

        /// <summary>
        /// 待匹配图形边界
        /// </summary>
        public Rectangle Bounds { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="name"></param>
        /// <param name="matchType"></param>
        /// <param name="bounds"></param>
        public ProcessMatchData(ProcessMatchType matchType, Rectangle bounds)
        {
            this.MatchType = matchType;
            this.Bounds = bounds;
        }

        public override string ToString()
        {
            if (MatchType == ProcessMatchType.None)
                return $"标定名:{Name},阈值:{Threshold},边界:{Bounds}";
            else
                return $"变量名:{VariableName},阈值:{Threshold},边界:{Bounds}";
        }
    }
}
